const { log } = require('console');
const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

// 生成一个1-100的随机数字
function randomNum() {
  return Math.floor(Math.random() * 100) + 1;
}
let num = randomNum()

let count = 0;
rl.on('line', (line) => {
  count++;
  // input += line;
  console.log(line);

  // 将输入的字符串转换成数字
  let inputNum = Number(line);
  console.log(inputNum,'您输入的是',inputNum);
  if (inputNum === num) {
    console.log(`恭喜你，你猜对了！共计猜了${count}次`);
    rl.close();
  } else if (inputNum > num) {
    console.log('太大了');
  } else if(inputNum < num) {
    console.log('太小了');
  }
});